package com.haoyuchanghong.com;

import android.util.Log;

import com.wiyun.engine.nodes.Director;
import com.wiyun.engine.nodes.Menu;
import com.wiyun.engine.nodes.MenuItemLabel;
import com.wiyun.engine.nodes.Scene;

public class LayerFirst extends MyLayer {
	public LayerFirst() {
		Log.e("crazy", "Creating layer 1");

		MenuItemLabel item1 = MenuItemLabel.make("新的游戏", this, "onPushScene");
		MenuItemLabel item2 = MenuItemLabel.make("Replace Scene", this, "onReplaceScene");
		MenuItemLabel item3 = MenuItemLabel.make("退出", this, "onQuit");

		Menu menu = Menu.make(item1, item2,item3);
		menu.alignItemsVertically();

		addChild(menu);
	}

	public void onPushScene() {
		Scene scene = Scene.make();
		scene.addChild(new LayerGame(false), 0);
		scene.autoRelease(true);
		Director.getInstance().pushScene(getTransition(scene));
	}

	public void onReplaceScene() {
		Scene scene = Scene.make();
		scene.addChild(new LayerGame(true), 0);
		scene.autoRelease(true);
		Director.getInstance().replaceScene(getTransition(scene));
	}

	public void onQuit() {
		Director.getInstance().popScene();
	}
}
